<template>
  <view>
    <special-banner :list="bannerList" @confirm="tapBanner"></special-banner>
  </view>
</template>

<script setup>
import { ref } from "vue";
import request from "@/lib/request.js";
import useApp from "@/hooks";
const { $ } = useApp();
import {
  onLoad,
  onShow,
  onPullDownRefresh,
  onReachBottom,
} from "@dcloudio/uni-app";
const bannerList = ref([
  {
    picture: "https://s1.ax1x.com/2023/01/12/pSuMShV.jpg",
    title: "PC大屏开源项目",
    description: "配套视频讲解",
    path: "",
  },
  {
    picture: "https://s1.ax1x.com/2023/01/12/pSuMShV.jpg",
    title: "小程序定制开发",
    description: "详情咨询客服",
    path: "",
  },
]);
// 每次渲染
onShow(() => {
  request({
    url: "/pms/notices",
    method: "GET",
    params: {
      pageSize: 100,
      pageNum: 1,
      status: 1,
    },
  }).then((res) => {
    //console.log(res)
    let arr = res.data.content;
    let t = $.buildArrayElePrefix(
      res.data.content,
      "fileId",
      $.api + "/ufs/download/"
    );
    t.map((ele) => {
      ele.picture = ele.fileId;
      ele.path = ele.content;
    });
    //console.log(t)
    bannerList.value = t;
  });
});
// 点击
function tapBanner(e) {
  console.log(e);
  uni.navigateTo({
    url: '/'+e.path,
  });
}
</script>

<style></style>
